<%@ Page Language="C#" Title="Notifications" AutoEventWireup="true" MasterPageFile="~/Default.Master"
    CodeBehind="Notification.aspx.cs" Inherits="Kiosk.WebManagement.Notification" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Assembly="Csla" Namespace="Csla.Web" TagPrefix="Csla" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .grid
        {
            margin: 0px 0px 0px 50px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="server">
    <ajaxToolkit:ToolkitScriptManager runat="server" EnableScriptGlobalization="true"
        EnablePageMethods="true" EnableScriptLocalization="true" ID="ToolkitScriptManager1" />
    <Csla:CslaDataSource ID="CSLADataSource1" runat="server" TypeAssemblyName="Kiosk.Library"
        TypeName="Kiosk.Library.NotificationReadOnlyList" TypeSupportsPaging="false"
        TypeSupportsSorting="false" OnDeleteObject="CSLADataSource1_DeleteObject" OnSelectObject="CSLADataSource1_SelectObject">
    </Csla:CslaDataSource>
    <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="GetAll"
        TypeName="Kiosk.Library.LocationReadOnlyList"></asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ObjectDataSource3" runat="server" SelectMethod="GetAll"
        TypeName="Kiosk.Library.NotificationTypeReadOnlyList" ></asp:ObjectDataSource>
    <asp:UpdatePanel ChildrenAsTriggers="true" runat="server" ID="UpdatePanel1">
        <ContentTemplate>
            <div class="TopContent">
                &nbsp;</div>
            <div class="MiddleContent">
                <asp:GridView ID="gvNotificationList" runat="server" AutoGenerateColumns="False"
                    DataSourceID="CSLADataSource1" AllowPaging="True" DataKeyNames="NotificationID"
                    CellPadding="4" ForeColor="#333333" GridLines="None" CssClass="grid" Width="640px"
                    OnSelectedIndexChanged="gvNotificationList_SelectedIndexChanged">
                    <FooterStyle BackColor="#3c3c3c" Font-Bold="True" ForeColor="White" />
                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    <Columns>
                        <asp:CommandField ButtonType="Image" 
                            SelectImageUrl="~/images/icons/resultset_next.png" ShowSelectButton="True" />
                        <asp:BoundField DataField="NotificationID" HeaderText="NotificationID" SortExpression="NotificationID"
                            Visible="False" ReadOnly="True" />
                        <asp:BoundField DataField="NotificationTypeID" HeaderText="NotificationTypeID" SortExpression="NotificationTypeID"
                            Visible="False" ReadOnly="True" />
                        <asp:BoundField DataField="LocationID" HeaderText="LocationID" SortExpression="LocationID"
                            Visible="False" ReadOnly="True" />
                        <asp:BoundField DataField="NotificationDate" HeaderText="NotificationDate" SortExpression="NotificationDate"
                            ReadOnly="True" />
                        <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" ReadOnly="True" />
                        <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description"
                            ReadOnly="True" />
                        <asp:BoundField DataField="LocationName" HeaderText="LocationName" SortExpression="LocationName"
                            ReadOnly="True" />
                        <asp:CommandField ButtonType="Image" HeaderText="Delete" DeleteImageUrl="~/images/icons/delete.png"
                            ShowDeleteButton="True" />
                    </Columns>
                    <PagerStyle BackColor="#3c3c3c" ForeColor="White" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <EditRowStyle BackColor="#999999" />
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                    <HeaderStyle BackColor="#3c3c3c" Font-Bold="true" ForeColor="White" />
                </asp:GridView>
                <asp:Button ID="btnAdd" CssClass="grid" runat="server" Text="Add Notification" OnClick="btnAdd_Click" />
            </div>
            <div class="BottomContent">
                &nbsp;</div>
                <br /><br />
                            <asp:Panel ID="pnlAdd" runat="server">
                <div class="TopContent">
                    &nbsp;</div>
                <div class="MiddleContent">
                    <table style="margin: 0px 0px 0px 50px;">
                        <tr>
                            <td>
                                <asp:Label ID="Label1" runat="server" Text="Title: "></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="txtTitle" runat="server"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="rfvTitle" runat="server" ErrorMessage="Title is required."
                                    ControlToValidate="txtTitle"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label2" runat="server" Text="Description: "></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="rfvDescription" runat="server" ErrorMessage="Description is required."
                                    ControlToValidate="txtDescription"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label5" runat="server" Text="Event Date: "></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="txtDate" runat="server"></asp:TextBox>
                                <ajaxToolkit:CalendarExtender ID="CalendarExtender1" TargetControlID="txtDate" runat="server">
                                </ajaxToolkit:CalendarExtender>
                                <asp:TextBox ID="txtTime" Width="70" runat="server"></asp:TextBox>
                                <ajaxToolkit:MaskedEditExtender ID="txtTimeext" TargetControlID="txtTime" AutoComplete="false"
                                    AcceptAMPM="true" AcceptNegative="None" Mask="99:99 " MaskType="Time" runat="server" />
                                <asp:CustomValidator ID="cvDate" runat="server" ErrorMessage="" OnServerValidate="cvDate_ServerValidate"
                                    ControlToValidate="txtDate">
                                </asp:CustomValidator>
                                <asp:RequiredFieldValidator ID="rfvDate" runat="server" ErrorMessage="Date is required."
                                    ControlToValidate="txtDate"></asp:RequiredFieldValidator>
                                <ajaxToolkit:MaskedEditValidator ID="MaskedEditValidator1" ControlExtender="txtTimeext" ControlToValidate="txtTime"
                                    IsValidEmpty="False" EmptyValueMessage="Time is required" EmptyValueBlurredText="Time is required"
                                    InvalidValueBlurredMessage="Time is required" InvalidValueMessage="Time is required"
                                    Display="Dynamic" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label3" runat="server" Text="Location: "></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="txtLocation" autocomplete="off" runat="server" />
                                <ajaxToolkit:AutoCompleteExtender runat="server" ID="autoComplete1" TargetControlID="txtLocation"
                                    ServiceMethod="GetLocationList" MinimumPrefixLength="1" CompletionInterval="100"
                                    EnableCaching="true" CompletionSetCount="20" CompletionListCssClass="autocomplete_completionListElement"
                                    CompletionListItemCssClass="autocomplete_listItem" CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"
                                    DelimiterCharacters=";, :">
                                </ajaxToolkit:AutoCompleteExtender>
                                <asp:CustomValidator ID="cvLocation" runat="server" ControlToValidate="txtLocation"
                                    ErrorMessage="" OnServerValidate="cvLocation_ServerValidate"></asp:CustomValidator>
                                <asp:RequiredFieldValidator ID="rfvLocation" runat="server" ControlToValidate="txtLocation"
                                    ErrorMessage="Location is required."></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label4" runat="server" Text="Notification Type: "></asp:Label>
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlNotificationType" runat="server" DataSourceID="ObjectDataSource3"
                                    DataTextField="Name" DataValueField="NotificationTypeID" >
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                                <asp:Button ID="btnSubmit" runat="server" Text="Save" OnClick="btnSubmit_Click" />
                                <asp:Button ID="btnCancel" CausesValidation="false" runat="server" Text="Cancel" OnClick="btnCancel_Click" />
                                <asp:CustomValidator ID="valUserFound" runat="server" EnableClientScript="False"
                                    ErrorMessage="You are not a valid user." OnServerValidate="valUserFound_ServerValidate"></asp:CustomValidator>
                            </td>
                        </tr>
                    </table>
                </div>
                <div class="BottomContent">
                    &nbsp;</div>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
